unit uSpoilScript;

interface

uses uCommonScript, Dialogs, SysUtils, uParamsController, uMainData, uConstants;

const
    SpoilerReUseTime: array [12..23] of TDateTime =
    (0.00005787,0.00005787,0,0,
    0,0,0,0,
    0,0,0,0);

const
    atSpoil = 12;
    atSweep = 13;

type
    TSpoilScript = class(TCommonScript)
    private
        IsSpoiled: boolean;
        procedure AnalisData; override;
        procedure SelfControll;
    public
        constructor Create;
        destructor Destroy;
        procedure LaunchScript;
    end;

implementation

uses fMain;

constructor TSpoilScript.Create;
var
    i: integer;
begin
    inherited;
    for i := 12 to High(FReUseTime) do
    begin
        FReUseTime[i] := SpoilerReUseTime[i];
    end;
end;

destructor TSpoilScript.Destroy;
begin
    inherited;
end;

procedure TSpoilScript.AnalisData;
begin
    inherited;
    if Main.cbScript.Checked then
    begin
        if MainData.TargetMP > 0 then
        begin
            AddNewAction(atChangeTarget, plHeight);
            exit;
        end;
        AddNewAction(atPetFood, plImmediately);
        if MainData.TargetHP > 0 then
        begin
            if MainData.TargetMP = 0 then
            begin
                AddNewAction(atAttack, plLow);
                if (MainData.TargetHP < 70) and (not IsSpoiled) then
                begin
                    AddNewAction(atSpoil, plHeight);
                    IsSpoiled := true;
                end;
            end;
        end
        else
        begin
            AddNewAction(atSweep, plImmediately);
            AddNewAction(atChangeTarget, plHeight);
            IsSpoiled := false;
        end;
    end;
end;

procedure TSpoilScript.LaunchScript;
begin
    inherited;
end;

procedure TSpoilScript.SelfControll;
begin
    inherited;
end;

end.
